<?php
class TBB_Utility_Redirector
{	
	public static function redirect($message, $module, $controller, $action)
	{
		$cusNS = new Zend_Session_Namespace('Customer');
		$cusNS->message = $message;
		$redirector = new Zend_Controller_Action_Helper_Redirector();		
		return $redirector->gotoUrl('/' . $module . '/' . $controller . '/' . $action);
	}
	
//	public static function forward($message, $module, $controller, $action) {
//		$
//	}
	
	public static function redirectIfSessionExpired()
	{
		$cusNS = new Zend_Session_Namespace('Customer');
	    if(isset($cusNS->expired)) {
	    	$redirector = new Zend_Controller_Action_Helper_Redirector();		
			return $redirector->gotoUrl('/error/expire');
		}
	}
	
	public static function setExpiredForSession($flag = true)
	{
		$cusNS = new Zend_Session_Namespace('Customer');
		if($flag) {		
			$cusNS->expired = true;
		} else {
			unset($cusNS->expired);
		}
	}

	public static function getMessage()
	{
		$cusNS = new Zend_Session_Namespace('Customer');
		return $cusNS->message;
	}
}